Skip to content

fix: schedules, restore direct update semantics and strengthen parsin…#205

Merged
socksy merged 1 commit intotower:developfrom
burakdede:fix/issue-167-schedule-validation
Feb 26, 2026
Merged

fix: schedules, restore direct update semantics and strengthen parsin…#205
socksy merged 1 commit intotower:developfrom
burakdede:fix/issue-167-schedule-validation

Conversation

@burakdede
Copy link
Contributor

…g tests

This PR fixes the schedule update CLI behavior reported with #167

schedules update argument parsing was semantically wrong due to allow_external_subcommands, so the schedule ID/flags could be parsed unreliably.

  • Made schedule_id an explicit required positional arg for update and delete in clap.
  • Removed the external-subcommand parsing path.
  • Kept direct PUT /schedules/{id_or_name} update behavior with parsed CLI fields.
  • Added regression tests to lock parsing behavior and parameter handling.

Possible backend issues still persisting;

  1. Missing cron semantic validation on update. Backend accepted and persisted not-a-cron for PUT /schedules/{id}.
  2. Potential missing cron validation on create as well. Needs explicit confirmation that create and update enforce the same cron rules.
  3. Schedule ID existence is validated, but cron correctness is not, leading to partial/inconsistent contract behavior. I didn't want to introduce client side validation, I believe this is backend-first responsibility.
image

@coderabbitai
Copy link

coderabbitai bot commented Feb 23, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@bradhe bradhe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another amazing improvement, thanks @burakdede ! We owe you a tshirt at least 😉 . Will leave this open for a day or so before landing it.

Comment on lines +75 to +79
Arg::new("schedule_id")
.required(true)
.value_parser(value_parser!(String))
.help("The schedule ID to delete")
.action(clap::ArgAction::Set),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah this is a good reminder that we need to support deleting schedules by name 😄

Comment on lines +88 to +92
Arg::new("schedule_id")
.required(true)
.value_parser(value_parser!(String))
.help("The schedule ID to update")
.action(clap::ArgAction::Set),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually can be by id or by name now 😄 https://docs.tower.dev/docs/reference/api/update-schedule. With name, you have to have --environment.

We have a lot of confusion about parameters with our users. People get confused by the differences in how we accept name/ID parameters:

tower schedules create --name=my-schedule --environmnet=production --cron="*/5 * * * *"

and

tower schedules update my-schedule --environmnet=production --cron="*/5 * * * *"

Something for us to address...

Copy link
Contributor

@socksy socksy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah good change! I'm working on exactly this clap code locally (removing allow_external_subcommands where possible since it seems to break so many default behaviours of clap) so let's get this in ASAP so I can rebase on it :)

@socksy socksy merged commit 58456c5 into tower:develop Feb 26, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants